package cn.inurl.util;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexUtil {
	public static String getStrByRegex(String str, String regex) {
		Pattern pattern = Pattern.compile(regex, java.util.regex.Pattern.CASE_INSENSITIVE);
		Matcher matcher = pattern.matcher(str);
		List<String> result = new ArrayList<String>();
		while (matcher.find()) {
			result.add(matcher.group());
		}
		if (result.size() == 0) {
			return null;
		}
		return result.get(0);
	}
}
